package com.wmwx.service;

import com.myspring.Autowired;
import com.myspring.BeanNameAware;
import com.myspring.Component;
import com.myspring.InitializeBean;
import com.myspring.Scope;

@Component("userService")
@Scope("singleton")
public class UserServiceImpl implements UserService, BeanNameAware, InitializeBean {
    @Autowired
    private OrderService orderService;

    private String beanName;

    @Override
    public void setName(String name) {
        this.beanName = name;
    }

    @Override
    public void printBeanName() {
        System.out.println(beanName);
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println(beanName + "被初始化了！");
    }

    @Override
    public void queryAllUsers() {
        System.out.println("调用了方法：查询所有的用户");
    }

    @Override
    public OrderService methodWithOrders() {
        return orderService;
    }
}
